﻿<ribbon:RibbonWindow x:Class="AssetWindow"
					 x:Name="AssetWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
					 WindowStartupLocation="CenterOwner" Width="Auto" Height="Auto" 
					 SizeToContent="WidthAndHeight"
					 xmlns:local="clr-namespace:ATS.UI.WPF"
					 Icon="../../images/Main/keys.png" >
	<ribbon:RibbonWindow.Resources>        
		<local:HalfValueConverter x:Key="HalfValue" />
        <Style TargetType="Label">
            <Setter Property= "Foreground"  Value="Blue" />
        </Style>
            
		<Style TargetType="Label" x:Key="MyLabel">
			<Setter Property="Foreground" Value="White" />
			<Setter Property="FontSize" Value="50"/>
			<Setter Property="Background" Value="LightBlue" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Label}">
						<Border BorderThickness="{TemplateBinding BorderThickness}"
								BorderBrush="{TemplateBinding BorderBrush}"
								Padding="{TemplateBinding Padding}"
								SnapsToDevicePixels="true">
							<Grid>
								<Rectangle Fill="{TemplateBinding Background}">
									<Rectangle.OpacityMask>
										<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
											<GradientStop Color="#80000000" Offset="0.0" />
											<GradientStop Color="#E6000000" Offset="0.5" />
											<GradientStop Color="#80000000" Offset="1.0" />
										</LinearGradientBrush>
									</Rectangle.OpacityMask>
								</Rectangle>
								<ContentPresenter
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									RecognizesAccessKey="True"
									SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
							</Grid>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground"
										Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}">
			<Setter Property="OverridesDefaultStyle" Value="true" />
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="BorderBrush" Value="Transparent" />
			<Setter Property="BorderThickness" Value="1" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="VerticalContentAlignment" Value="Center" />
			<Setter Property="Padding" Value="3" />
			<Setter Property="Opacity" Value=".80" />
			<Setter Property="LayoutTransform">
				<Setter.Value>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border Background="{TemplateBinding Background}" 
								BorderBrush="{TemplateBinding BorderBrush}" 
								BorderThickness="{TemplateBinding BorderThickness}" 
								Padding="{TemplateBinding Padding}">
							<ContentPresenter x:Name="ContentSite" 
											  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
											  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelected" Value="true">
								<Setter Property="Background">
									<Setter.Value>
										<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
											<LinearGradientBrush.GradientStops>
												<GradientStop Offset="0" Color="LightGray"/>
												<GradientStop Offset="1" Color="DarkGray"/>
											</LinearGradientBrush.GradientStops>
										</LinearGradientBrush>
									</Setter.Value>
								</Setter>
								<Setter Property="BorderBrush" Value="Silver" />
								<Setter Property="Opacity" Value="1"/>
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true" />
									<Condition Property="Selector.IsSelectionActive" 
											   Value="false" />
								</MultiTrigger.Conditions>
								<Setter Property="Background" Value="LightGray" />
								<Setter Property="BorderBrush" Value="DarkGray" />
							</MultiTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="Gray" />
				</Trigger>
				<EventTrigger RoutedEvent="Mouse.MouseEnter">
					<EventTrigger.Actions>
						<BeginStoryboard>
							<Storyboard>
								<!--DoubleAnimation Duration="0:0:0.0"                                                 
												 Storyboard.TargetProperty="(ListBoxItem.LayoutTransform).(ScaleTransform.ScaleY)"
												 From="1" To="1.125"/>
									<DoubleAnimation Duration="0:0:0.0"                                                 
												 Storyboard.TargetProperty="(ListBoxItem.LayoutTransform).(ScaleTransform.ScaleX)"
												 From="1" To="1.125"/-->
								<DoubleAnimation Duration="0:0:0.2"
												 Storyboard.TargetProperty="Opacity"
												 To="1.0" />
							</Storyboard>
						</BeginStoryboard>
					</EventTrigger.Actions>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseLeave">
					<EventTrigger.Actions>
						<BeginStoryboard>
							<Storyboard>
								<!--DoubleAnimation Duration="0:0:0.0"
												 Storyboard.TargetProperty="(ListBoxItem.LayoutTransform).(ScaleTransform.ScaleY)"
												 From="1.125" To="1"/>
									<DoubleAnimation Duration="0:0:0.0"                                                 
												 Storyboard.TargetProperty="(ListBoxItem.LayoutTransform).(ScaleTransform.ScaleX)"
												 From="1.125" To="1"/-->
								<DoubleAnimation Duration="0:0:0.2"
												 Storyboard.TargetProperty="Opacity" />
							</Storyboard>
						</BeginStoryboard>
					</EventTrigger.Actions>
				</EventTrigger>
			</Style.Triggers>
		</Style>


		<DataTemplate x:Key="listBoxTemplate">
			<Border BorderBrush="Blue"
					BorderThickness="1"
					CornerRadius="1"
					Margin="1">
				<StackPanel Orientation="Vertical">
					<TextBlock Text="{Binding Assetno}" 
							   Foreground="Green" 
							   FontWeight="Bold"
								   Name="username" Margin="1"/>
					<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0">
						<Label Content="{Binding CategoryCode}" 
							   Foreground="Green" Name="categoryCode" HorizontalAlignment="Left"  VerticalAlignment="Center"/>
					</StackPanel>
				</StackPanel>
			</Border>
		</DataTemplate>

		<DataTemplate x:Key="listBoxImageTemplate">
			<Border BorderBrush="Blue"
					BorderThickness="1"
					CornerRadius="1"
					Margin="1">
				<StackPanel Orientation="Vertical">
					<Image Source="/images/controls/button_cancelx.png"                           
						   Width="10"
						   Height="10"
						   Margin="2"
						   HorizontalAlignment="Right"
						   Name="buttonDeleteCustomerVehicle"
						   
						   ></Image>
					<Image Source="{Binding ImageLocation}"
						   MinWidth="5"
						   Width="100"
						   Height="100"
						   Margin="2"
						   ></Image>
					<TextBlock Text="{Binding ImageName}" 
							   Foreground="Green" 
							   FontWeight="Bold"
								   Margin="2"
							   HorizontalAlignment="Center" />
				</StackPanel>
			</Border>
		</DataTemplate>
	</ribbon:RibbonWindow.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<ribbon:Ribbon x:Name="Ribbon" Grid.Row="0">
			<ribbon:Ribbon.ApplicationMenu>
				<ribbon:RibbonApplicationMenu Visibility="Collapsed" >
				</ribbon:RibbonApplicationMenu>
			</ribbon:Ribbon.ApplicationMenu>
			<ribbon:Ribbon.QuickAccessToolBar>
				<ribbon:RibbonQuickAccessToolBar Visibility="Collapsed"></ribbon:RibbonQuickAccessToolBar>
			</ribbon:Ribbon.QuickAccessToolBar>

			<ribbon:RibbonTab x:Name="AssetTab"
							  
							  Header="Asset">
				<ribbon:RibbonGroup x:Name="Actions"
									Header="Actions">
					<ribbon:RibbonButton x:Name="buttonNew"
										 LargeImageSource="../../images/actions/ctrladd.png"
										 Label="New" />
					<ribbon:RibbonButton x:Name="buttonRefresh"
										 LargeImageSource="../../images/actions/Refresh-64.png"
										 Label="Refresh" />
					<ribbon:RibbonButton x:Name="buttonSave"
										 LargeImageSource="../../images/actions/ctrlsave.png"
										 Label="Save" />
				</ribbon:RibbonGroup>
			</ribbon:RibbonTab>
			<ribbon:RibbonTab x:Name="SearchTab"							  
							  Header="Search">
			</ribbon:RibbonTab>

		</ribbon:Ribbon>

		<Grid Grid.Row="1">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="auto"></ColumnDefinition>
				<ColumnDefinition Width="*"></ColumnDefinition>
			</Grid.ColumnDefinitions>
			<Expander Width="Auto" ExpandDirection="Right" HorizontalAlignment="Right" Grid.Column="0" x:Name="ExpanderList">
				<Expander.Header>
					<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="Auto" Name="ExpanderText">
			<TextBlock.LayoutTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="90"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.LayoutTransform>
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
					</TextBlock>
				</Expander.Header>

				<Border Name="borderHeader" BorderBrush="Gray" 
				BorderThickness="1,1,1,1" 
									CornerRadius="6,6,6,6">
					<Grid Name="gridListbox">
						<Grid.RowDefinitions>
							<RowDefinition Height="auto"></RowDefinition>
							<RowDefinition></RowDefinition>
						</Grid.RowDefinitions>

						<StackPanel Orientation="Horizontal" 
									Background="Aquamarine"
									VerticalAlignment="Top"
									Margin="2" Grid.Row="0">
							<TextBox MinHeight="10" 
									 MinWidth="126"
									 Margin="2"
									 Name="searchBox">Search</TextBox>
						</StackPanel>
						<ListBox Name="listBoxItems"    
						 Grid.Row="1" 
						 
						 HorizontalContentAlignment="Stretch"
						 ItemContainerStyle="{DynamicResource ListBoxItem}" 
						 ItemTemplate="{StaticResource listBoxTemplate}" 
						 IsSynchronizedWithCurrentItem="True"
						 ItemsSource="{Binding}"
						 VerticalAlignment="Top"  Height="auto"></ListBox>
						<Control Grid.RowSpan="2"
								 x:Name="busyAnimation" 
								 Style="{StaticResource BusyAnimationStyle}"
								 Width="{Binding Path=ActualWidth, ElementName=listBoxCategories}" 
								 Height="{Binding Path=ActualHeight, ElementName=imagelistBoxUsers}" />
					</Grid>

				</Border>
			</Expander>

			<Border Name="borderHeader1" 
				Grid.Column="1" 
				BorderBrush="Gray" 
				BorderThickness="0,1,1,1" 
				CornerRadius="6,6,6,6">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="auto"></RowDefinition>
						<RowDefinition></RowDefinition>
					</Grid.RowDefinitions>
					<Border Name="borderHeader2" 
				Grid.Row="0"
				BorderBrush="Gray" 
				BorderThickness="0,1,1,1" 
				CornerRadius="6,6,6,6">

					</Border>

					<TabControl Name="TabControlItems" Grid.Row="1" Background="Transparent">
						<TabItem Header="General" Name="TabItemGeneral">
							<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
								<StackPanel VerticalAlignment="Top">
									<Grid Name="gridItemGeneral">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="auto"></ColumnDefinition>
											<ColumnDefinition></ColumnDefinition>
										</Grid.ColumnDefinitions>
										<Grid.RowDefinitions>
											<RowDefinition Height="auto" ></RowDefinition>
											<RowDefinition ></RowDefinition>
										</Grid.RowDefinitions>
										<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Left">
											<Label Margin="5,5,5,0" Foreground="Red" HorizontalAlignment="Left" FontWeight="Bold">Description</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxDescription"
													 Text="{Binding Path=DescriptiveName
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=True}"
										 Validation.Error="TextBox_Error"></TextBox>
                                            <Label Margin="5,5,5,0" Foreground="Red" HorizontalAlignment="Left"  FontWeight="Bold" >Category</Label>
											<!-- ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxCategory" ItemsSource ="{Binding}" IsEditable="True" TextBoxBase.TextChanged="comboBoxCategory_TextChanged" -->
											<ComboBox Margin="5,0,5,5" 
												  HorizontalAlignment="Left" 
												  Grid.Row="8" 
												  Width="200" 
												  Name="comboboxCategory"                                                   
												  IsEditable="False"
													  SelectedValue  ="{Binding Path=CategoryCode
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error">
												<ComboBox.Resources>
													<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
													<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
												</ComboBox.Resources>
											</ComboBox>
											<GroupBox Margin="5,5,5,0" Header="Location">
												<StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Location</Label>
													<!-- ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxLocation" ItemsSource ="{Binding}" IsEditable="True" TextBoxBase.TextChanged="comboboxLocation_TextChanged" -->
													<ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxLocation"  IsEditable="True"
															  SelectedValue  ="{Binding
									Path=LocationCode}"
                                                              
                                                              
                                                              Text  ="{Binding
									Path=LocationCode
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
                                                              
															   Validation.Error="TextBox_Error">
														<ComboBox.Resources>
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
														</ComboBox.Resources>
													</ComboBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Department</Label>
													<!-- ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxDepartment" ItemsSource ="{Binding}" IsEditable="True" TextBoxBase.TextChanged="comboboxDepartment_TextChanged" -->
													<ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxDepartment"  IsEditable="True"
															  SelectedValue  ="{Binding
									Path=DeptCode}"
                                                              
                                                              Text  ="{Binding
									Path=DeptCode
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error">
														<ComboBox.Resources>
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
														</ComboBox.Resources>
													</ComboBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Section</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxSection"
															 Text="{Binding
									Path=Section
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=True}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Assigned To</Label>
													<!-- ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxPerson" ItemsSource ="{Binding}" IsEditable="True" TextBoxBase.TextChanged="comboboxPerson_TextChanged" -->
													<ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxPerson" IsEditable="False"
                                                               SelectedValue  ="{Binding
									Path=AssignToEmployeeCode
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error">
                                                        <ComboBox.ItemTemplate>
                                                            <DataTemplate>
                                                                <StackPanel Orientation="Horizontal">
                                                                    <TextBlock Text="{Binding Path=LastName}"></TextBlock>
                                                                    <TextBlock Text=", "></TextBlock>
                                                                    <TextBlock Text="{Binding Path=FirstName}"></TextBlock>
                                                                </StackPanel>
                                                            </DataTemplate>
                                                        </ComboBox.ItemTemplate>
                                                        <ComboBox.Resources>
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
														</ComboBox.Resources>
													</ComboBox>
												</StackPanel>
											</GroupBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Salvage Value</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxSalvageValue"
                                                      Text="{Binding
									Path=SalvageValue
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Replacement Cost</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxReplacementCost"
                                                     Text="{Binding
									Path=ReplacementCost
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Condition</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxCondition"
                                                     Text="{Binding
									Path=Condition
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=True}"
										 Validation.Error="TextBox_Error"></TextBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Status</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxStatus"
                                                     Text="{Binding
									Path=Status
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=True}"
										 Validation.Error="TextBox_Error"></TextBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left" >Serial Number</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxSerialNumber"
                                                     Text="{Binding
									Path=SerialNumber
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=True}"
										 Validation.Error="TextBox_Error"></TextBox>
										</StackPanel>
										<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Left">
                                            <Label Margin="5,5,5,0" Foreground="Red" HorizontalAlignment="Left"  FontWeight="Bold">Asset Reference Number</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxAssetNumber"
													  Text="{Binding
									Path=Assetno
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
											<Label Margin="5,5,5,0" HorizontalAlignment="Left">RFID Number</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxRFIDNumber"
													Text="{Binding
									Path=RFIDno
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
											<GroupBox Margin="5,5,5,0" Header="Purchase Information">
												<StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Invoice/PO Number</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxInvoiceNumber"
                                                             Text="{Binding
									Path=InvoiceNumber
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Purchased Date</Label>
													
													
														<DatePicker Margin="0,0,5,5"                                                     
																	Name="textboxPurchasedDate"                                                                     
																	IsEnabled="True"  SelectedDate="{Binding
									Path=DateAcquired
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
										  Validation.Error="TextBox_Error"></DatePicker>
													
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Bought From</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxBoughtFrom"
                                                             Text="{Binding 
									Path=BoughtFrom
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Base Cost</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxBaseCost"
                                                             Text="{Binding
									Path=BaseCost
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">VAT</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxVAT"
                                                             Text="{Binding
									Path=VAT
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Total Cost</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxTotalCost" IsReadOnly="True"
                                                             Text="{Binding
									Path=TotalCost
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}, Mode=OneWay}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Manufacturer</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxManufacturer"
                                                             Text="{Binding
									Path=Manufacturer
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Brand</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxBrand"
                                                             Text="{Binding
									Path=BrandName
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Model Number</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxModelNumber"
                                                             Text="{Binding
									Path=ModelNumber
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
												</StackPanel>
											</GroupBox>
										</StackPanel>
										<StackPanel Grid.ColumnSpan="2" Grid.Row="1">
											<Label Margin="5,5,5,0" HorizontalAlignment="Left">Remarks</Label>
											<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="450" Height="100" Name="textboxRemarks"
                                                     Text="{Binding
									Path=Remarks
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
										</StackPanel>
									</Grid>
								</StackPanel>
							</ScrollViewer>
						</TabItem>
						<TabItem Header="Additional" Name="TabItemAdditional">
							<ScrollViewer>
								<StackPanel VerticalAlignment="Top">
									<Grid Name="gridItemAdditional">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="auto"></ColumnDefinition>
											<ColumnDefinition Width="auto"></ColumnDefinition>
										</Grid.ColumnDefinitions>
										<StackPanel Grid.Column="0" Orientation="Vertical">
											<GroupBox Margin="5,5,5,0" Name="groupBoxLeasedAsset">
												<GroupBox.Header>
													<CheckBox x:Name="checkboxLeaseAsset">Leased Asset</CheckBox>
												</GroupBox.Header>
												<StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=checkboxLeaseAsset, Path=IsChecked}">

													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Lease start</Label>
													<StackPanel Orientation="Horizontal">
														<CheckBox Margin="5,0,5,5" 
															  VerticalAlignment="Center"
															  Name="cbCalendarLeaseStart"></CheckBox>
														<DatePicker Margin="0,0,5,5"                                                     
																	Name="textboxLeaseStart" 
																	SelectedDate="{Binding
									Path=LeasedAsset.LeaseBegin
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
										  Validation.Error="TextBox_Error"></DatePicker>
													</StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Lease end</Label>
													<StackPanel Orientation="Horizontal">
														<CheckBox Margin="5,0,5,5" 
															  VerticalAlignment="Center"
															  Name="cbCalendarLeaseEnd"></CheckBox>
														<DatePicker Margin="0,0,5,5"                                                     
																	Name="textboxLeaseEnd" 
																	SelectedDate="{Binding
									Path=LeasedAsset.LeaseEnd
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
										  Validation.Error="TextBox_Error"></DatePicker>
													</StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Details</Label>
													<TextBox Margin="5,5,5,0" Width="250" Height="100" Name="textboxLeaseDetails"
                                                             Text="{Binding
									Path=LeasedAsset.LeaseDescription
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error"></TextBox>
												</StackPanel>
											</GroupBox>
											<GroupBox Margin="5,5,5,0" Name="groupBoxWarranty" >
												<GroupBox.Header>
													<CheckBox x:Name="checkboxWarranty" >Warranty</CheckBox>
												</GroupBox.Header>
												<StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=checkboxWarranty, Path=IsChecked}">
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Warranty end</Label>
													<StackPanel Orientation="Horizontal">
														<CheckBox Margin="5,0,5,5" 
															  VerticalAlignment="Center"
															  Name="cbCalendarWarrantyEnd"></CheckBox>
														<DatePicker Margin="0,0,5,5"                                                     
																	Name="textboxWarrantyEnd" 
																	
																	IsEnabled="False"
																	></DatePicker>
													</StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Details</Label>
													<TextBox Margin="5,5,5,0" Width="250" Height="100" Name="textboxWarrantyDetails"></TextBox>
												</StackPanel>
											</GroupBox>
										</StackPanel>
										<StackPanel Grid.Column="1">
											<GroupBox Margin="5,5,5,0" Name="groupBoxDispose">
												<GroupBox.Header>
													<CheckBox x:Name="checkBoxDisposedAsset">Dispose</CheckBox>
												</GroupBox.Header>
												<StackPanel Orientation="Vertical" IsEnabled="{Binding ElementName=checkBoxDisposedAsset, Path=IsChecked}"  Name="DisposedDetails">
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Disposal type</Label>
													<ComboBox Margin="5,0,5,5" HorizontalAlignment="Left" Grid.Row="8" Width="200" Name="comboboxDisposalType"  IsEditable="True"
                                                              SelectedValue  ="{Binding
									Path=DisposedAsset.DisposalMethod}"
                                                              Text  ="{Binding
									Path=DisposedAsset.DisposalMethod
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
															   Validation.Error="TextBox_Error">
														<ComboBox.Resources>
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
															<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
														</ComboBox.Resources>
													</ComboBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Date disposed</Label>
													<StackPanel Orientation="Horizontal">
														<CheckBox Margin="5,0,5,5" 
															  VerticalAlignment="Center"
															  Name="cbCalendarDateDisposed"></CheckBox>
														<DatePicker Margin="0,0,5,5"                                                     
																	Name="textboxDateDisposed" 
																	
																	SelectedDate="{Binding
									Path=DisposedAsset.DateSold
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue=''
									, NotifyOnValidationError=true}"
										  Validation.Error="TextBox_Error"></DatePicker>
													</StackPanel>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Amount sold</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxAmountSold"
                                                             Text="{Binding
									Path=DisposedAsset.AmountSold
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Profit</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxProfit"
                                                             Text="{Binding
									Path=DisposedAsset.Profit
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Gain/Loss</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxGainLoss"
                                                             Text="{Binding
									Path=DisposedAsset.DisposalGainLoss
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">Accumulated depreciation</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxAccumulatedDepreciation"
                                                             IsReadOnly="True"
                                                             Text="{Binding
									Path=DisposedAsset.AccumulatedDepreciation
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}, Mode=OneWay}"
										 Validation.Error="TextBox_Error"></TextBox>
													<Label Margin="5,5,5,0" HorizontalAlignment="Left">BV</Label>
													<TextBox Margin="5,0,5,5" HorizontalAlignment="Left" Width="200" Name="textboxBV"
                                                             Text="{Binding
									Path=DisposedAsset.DisposalBV
									, UpdateSourceTrigger=PropertyChanged
									, ValidatesOnExceptions=True
									, TargetNullValue='0.00'
                                                ,FallbackValue='0.00'
									, NotifyOnValidationError=True, StringFormat={}{0:N2}}"
										 Validation.Error="TextBox_Error"></TextBox>
												</StackPanel>
											</GroupBox>
										</StackPanel>
									</Grid>
								</StackPanel>
							</ScrollViewer>
						</TabItem>
						<TabItem Header="Images" Name="TabItemImages" >
							<ScrollViewer>
								<StackPanel VerticalAlignment="Top">
									<Grid Name="gridItemImages">
										<Grid.RowDefinitions>
											<RowDefinition Height="auto"></RowDefinition>
											<RowDefinition></RowDefinition>
										</Grid.RowDefinitions>
										<StackPanel HorizontalAlignment="left" Orientation="Horizontal" Grid.Row="0">
											<Button Name="btnAddImage" Margin="5"  Width="100">Add Image</Button>
										</StackPanel  >
										<Grid Grid.Row="1">
											<ListBox Grid.Row="3"
												 Name="ListBoxItemImages"
												 ItemsSource="{Binding}"
												 ItemTemplate="{StaticResource listBoxImageTemplate}"  >
												<ListBox.ItemsPanel>
													<ItemsPanelTemplate>
														<WrapPanel IsItemsHost="True"
															   Width="{Binding ActualWidth,
														RelativeSource={RelativeSource Mode=FindAncestor, 
														AncestorType={x:Type ScrollContentPresenter}}}" />
													</ItemsPanelTemplate>
												</ListBox.ItemsPanel>
											</ListBox>

										</Grid>

									</Grid>
								</StackPanel>
							</ScrollViewer>
						</TabItem>
					</TabControl>
				</Grid>
			</Border>
			<Border Name="mainOverlay" Grid.Column="1" CornerRadius="6,6,6,6" Visibility="Collapsed">
				<DockPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="LightBlue">
					<DockPanel.OpacityMask >
						<LinearGradientBrush StartPoint="0.5,1" EndPoint="0.5,1">
							<GradientStop Color="#80000000" Offset="0.0" />
							<GradientStop Color="#E6000000" Offset="0.5" />
							<GradientStop Color="#80000000" Offset="1.0" />
						</LinearGradientBrush>
					</DockPanel.OpacityMask >

					<Label  VerticalAlignment="Center" HorizontalAlignment="Center" Style="{StaticResource MyLabel}">empty record</Label>

				</DockPanel>
			</Border>
		</Grid>
		<Canvas Name="NewItemCanvas" Grid.Column="1"  Visibility="Collapsed" Grid.RowSpan="2" Grid.Row="0" >
			<Canvas.Background>
				<LinearGradientBrush StartPoint="0.5,1" EndPoint="0.5,1">
					<GradientStop Color="#80000000" Offset="0.0" />
					<GradientStop Color="#E6000000" Offset="0.5" />
					<GradientStop Color="#80000000" Offset="1.0" />
				</LinearGradientBrush>
			</Canvas.Background>
			<local:ucNewItem  x:Name="ucNewItem"  Width="250"
					 Height="125">
				<Canvas.Left>
					<MultiBinding Converter="{StaticResource HalfValue}">
						<Binding ElementName="NewItemCanvas" Path="ActualWidth" />
						<Binding ElementName="ucNewItem" Path="ActualWidth" />
					</MultiBinding>
				</Canvas.Left>
				<Canvas.Top>
					<MultiBinding Converter="{StaticResource HalfValue}">
						<Binding ElementName="NewItemCanvas" Path="ActualHeight" />
						<Binding ElementName="ucNewItem" Path="ActualHeight" />
					</MultiBinding>
				</Canvas.Top>

			</local:ucNewItem>
		</Canvas>
		<Control Grid.RowSpan="2"
								 x:Name="busyAnimationSaveAndDelete" 
								 Style="{StaticResource BusyAnimationStyle}"
								 Width="{Binding Path=ActualWidth, ElementName=mainGrid}" 
								 Height="{Binding Path=ActualHeight, ElementName=mainGrid}" 
				 Visibility="Collapsed" />

	</Grid>


</ribbon:RibbonWindow>


	
		  
